/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import {View, Text, StyleSheet} from 'react-native';
import React, {FC, ReactNode} from 'react';

/** Title 组件传参 */
type TitleProps = {
  /** 标题 */
  title: string;
  /** 底部外边距 */
  marginBottom?: number;
  /** 主题色 */
  colorScheme: 'light' | 'dark';
};

/**
 * @description 首页标题组件
 * @param TitleProps
 * @returns Title组件
 */
const Title: FC<TitleProps> = ({title, marginBottom = 0, colorScheme}): ReactNode => {
  return (
    <View style={[styles.container, {marginBottom}]}>
      <Text numberOfLines={1} style={[styles.text, {color: colorScheme === 'dark' ? '#fff' : '#000'}]}>
        {title}
      </Text>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    paddingTop: 24,
    paddingbottom: 8,
  },
  text: {
    fontFamily: 'HarmonyHeiTi',
    fontSize: 18,
    lineHeight: 24,
    fontWeight: '600',
    color: 'rgba(0, 0, 0, 0.9)',
  },
});

export default Title;
